3.15 \(\int \frac{A+B x}{(a+b x+c x^2) (d+e x+f x^2)} \, dx\)

Optimal. Leaf size=406 \[ \frac{\tanh ^{-1}\left (\frac{e+2 f x}{\sqrt{e^2-4 d f}}\right ) \left (B (a e f-2 b d f+c d e)-A \left (2 a f^2-b e f-2 c d f+c e^2\right )\right )}{\sqrt{e^2-4 d f} \left (f \left (a^2 f-a b e+b^2 d\right )-c \left (b d e-a \left (e^2-2 d f\right )\right )+c^2 d^2\right )}+\frac{\log \left (a+b x+c x^2\right ) (-a B f+A b f-A c e+B c d)}{2 \left (f \left (a^2 f-a b e+b^2 d\right )-c \left (b d e-a \left (e^2-2 d f\right )\right )+c^2 d^2\right )}-\frac{\log \left (d+e x+f x^2\right ) (-a B f+A b f-A c e+B c d)}{2 \left (f \left (a^2 f-a b e+b^2 d\right )-c \left (b d e-a \left (e^2-2 d f\right )\right )+c^2 d^2\right )}-\frac{\tanh ^{-1}\left (\frac{b+2 c x}{\sqrt{b^2-4 a c}}\right ) \left (-b (a B f+A c e+B c d)+2 c (-a A f+a B e+A c d)+A b^2 f\right )}{\sqrt{b^2-4 a c} \left (f \left (a^2 f-a b e+b^2 d\right )-c \left (b d e-a \left (e^2-2 d f\right )\right )+c^2 d^2\right )} \]

[Out]

-(((A*b^2*f + 2*c*(A*c*d + a*B*e - a*A*f) - b*(B*c*d + A*c*e + a*B*f))*ArcTanh[(b + 2*c*x)/Sqrt[b^2 - 4*a*c]])
/(Sqrt[b^2 - 4*a*c]*(c^2*d^2 + f*(b^2*d - a*b*e + a^2*f) - c*(b*d*e - a*(e^2 - 2*d*f))))) + ((B*(c*d*e - 2*b*d
*f + a*e*f) - A*(c*e^2 - 2*c*d*f - b*e*f + 2*a*f^2))*ArcTanh[(e + 2*f*x)/Sqrt[e^2 - 4*d*f]])/(Sqrt[e^2 - 4*d*f
]*(c^2*d^2 + f*(b^2*d - a*b*e + a^2*f) - c*(b*d*e - a*(e^2 - 2*d*f)))) + ((B*c*d - A*c*e + A*b*f - a*B*f)*Log[
a + b*x + c*x^2])/(2*(c^2*d^2 + f*(b^2*d - a*b*e + a^2*f) - c*(b*d*e - a*(e^2 - 2*d*f)))) - ((B*c*d - A*c*e +
A*b*f - a*B*f)*Log[d + e*x + f*x^2])/(2*(c^2*d^2 + f*(b^2*d - a*b*e + a^2*f) - c*(b*d*e - a*(e^2 - 2*d*f))))

________________________________________________________________________________________

Rubi [A]  time = 0.477553, antiderivative size = 398, normalized size of antiderivative = 0.98, number of steps used = 9, number of rules used = 5, integrand size = 30, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.167, Rules used = {1022, 634, 618, 206, 628} \[ \frac{\tanh ^{-1}\left (\frac{e+2 f x}{\sqrt{e^2-4 d f}}\right ) \left (B (a e f-2 b d f+c d e)-A \left (2 a f^2-b e f-2 c d f+c e^2\right )\right )}{\sqrt{e^2-4 d f} \left (f \left (a^2 f-a b e+b^2 d\right )+a c \left (e^2-2 d f\right )-b c d e+c^2 d^2\right )}+\frac{\log \left (a+b x+c x^2\right ) (-a B f+A b f-A c e+B c d)}{2 \left (f \left (a^2 f-a b e+b^2 d\right )+a c \left (e^2-2 d f\right )-b c d e+c^2 d^2\right )}-\frac{\log \left (d+e x+f x^2\right ) (-a B f+A b f-A c e+B c d)}{2 \left (f \left (a^2 f-a b e+b^2 d\right )+a c \left (e^2-2 d f\right )-b c d e+c^2 d^2\right )}-\frac{\tanh ^{-1}\left (\frac{b+2 c x}{\sqrt{b^2-4 a c}}\right ) \left (-b (a B f+A c e+B c d)+2 c (-a A f+a B e+A c d)+A b^2 f\right )}{\sqrt{b^2-4 a c} \left (f \left (a^2 f-a b e+b^2 d\right )+a c \left (e^2-2 d f\right )-b c d e+c^2 d^2\right )} \]

Antiderivative was successfully verified.

[In]

Int[(A + B*x)/((a + b*x + c*x^2)*(d + e*x + f*x^2)),x]

[Out]

-(((A*b^2*f + 2*c*(A*c*d + a*B*e - a*A*f) - b*(B*c*d + A*c*e + a*B*f))*ArcTanh[(b + 2*c*x)/Sqrt[b^2 - 4*a*c]])
/(Sqrt[b^2 - 4*a*c]*(c^2*d^2 - b*c*d*e + f*(b^2*d - a*b*e + a^2*f) + a*c*(e^2 - 2*d*f)))) + ((B*(c*d*e - 2*b*d
*f + a*e*f) - A*(c*e^2 - 2*c*d*f - b*e*f + 2*a*f^2))*ArcTanh[(e + 2*f*x)/Sqrt[e^2 - 4*d*f]])/(Sqrt[e^2 - 4*d*f
]*(c^2*d^2 - b*c*d*e + f*(b^2*d - a*b*e + a^2*f) + a*c*(e^2 - 2*d*f))) + ((B*c*d - A*c*e + A*b*f - a*B*f)*Log[
a + b*x + c*x^2])/(2*(c^2*d^2 - b*c*d*e + f*(b^2*d - a*b*e + a^2*f) + a*c*(e^2 - 2*d*f))) - ((B*c*d - A*c*e +
A*b*f - a*B*f)*Log[d + e*x + f*x^2])/(2*(c^2*d^2 - b*c*d*e + f*(b^2*d - a*b*e + a^2*f) + a*c*(e^2 - 2*d*f)))

Rule 1022

Int[((g_.) + (h_.)*(x_))/(((a_) + (b_.)*(x_) + (c_.)*(x_)^2)*((d_) + (e_.)*(x_) + (f_.)*(x_)^2)), x_Symbol] :>
 With[{q = Simplify[c^2*d^2 - b*c*d*e + a*c*e^2 + b^2*d*f - 2*a*c*d*f - a*b*e*f + a^2*f^2]}, Dist[1/q, Int[Sim
p[g*c^2*d - g*b*c*e + a*h*c*e + g*b^2*f - a*b*h*f - a*g*c*f + c*(h*c*d - g*c*e + g*b*f - a*h*f)*x, x]/(a + b*x
 + c*x^2), x], x] + Dist[1/q, Int[Simp[-(h*c*d*e) + g*c*e^2 + b*h*d*f - g*c*d*f - g*b*e*f + a*g*f^2 - f*(h*c*d
 - g*c*e + g*b*f - a*h*f)*x, x]/(d + e*x + f*x^2), x], x] /; NeQ[q, 0]] /; FreeQ[{a, b, c, d, e, f, g, h}, x]
&& NeQ[b^2 - 4*a*c, 0] && NeQ[e^2 - 4*d*f, 0]

Rule 634

Int[((d_.) + (e_.)*(x_))/((a_) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Dist[(2*c*d - b*e)/(2*c), Int[1/(a +
 b*x + c*x^2), x], x] + Dist[e/(2*c), Int[(b + 2*c*x)/(a + b*x + c*x^2), x], x] /; FreeQ[{a, b, c, d, e}, x] &
& NeQ[2*c*d - b*e, 0] && NeQ[b^2 - 4*a*c, 0] &&  !NiceSqrtQ[b^2 - 4*a*c]

Rule 618

Int[((a_.) + (b_.)*(x_) + (c_.)*(x_)^2)^(-1), x_Symbol] :> Dist[-2, Subst[Int[1/Simp[b^2 - 4*a*c - x^2, x], x]
, x, b + 2*c*x], x] /; FreeQ[{a, b, c}, x] && NeQ[b^2 - 4*a*c, 0]

Rule 206

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1*ArcTanh[(Rt[-b, 2]*x)/Rt[a, 2]])/(Rt[a, 2]*Rt[-b, 2]), x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 628

Int[((d_) + (e_.)*(x_))/((a_.) + (b_.)*(x_) + (c_.)*(x_)^2), x_Symbol] :> Simp[(d*Log[RemoveContent[a + b*x +
c*x^2, x]])/b, x] /; FreeQ[{a, b, c, d, e}, x] && EqQ[2*c*d - b*e, 0]

Rubi steps

\begin{align*} \int \frac{A+B x}{\left (a+b x+c x^2\right ) \left (d+e x+f x^2\right )} \, dx &=\frac{\int \frac{a B (c e-b f)+A \left (c^2 d+b^2 f-c (b e+a f)\right )+c (B c d-A c e+A b f-a B f) x}{a+b x+c x^2} \, dx}{c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )}+\frac{\int \frac{-A f (b e-a f)+A c \left (e^2-d f\right )-B (c d e-b d f)-f (B c d-A c e+A b f-a B f) x}{d+e x+f x^2} \, dx}{c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )}\\ &=\frac{(B c d-A c e+A b f-a B f) \int \frac{b+2 c x}{a+b x+c x^2} \, dx}{2 \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}-\frac{(B c d-A c e+A b f-a B f) \int \frac{e+2 f x}{d+e x+f x^2} \, dx}{2 \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}+\frac{\left (A b^2 f+2 c (A c d+a B e-a A f)-b (B c d+A c e+a B f)\right ) \int \frac{1}{a+b x+c x^2} \, dx}{2 \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}+\frac{\left (e f (B c d-A c e+A b f-a B f)+2 f \left (-A f (b e-a f)+A c \left (e^2-d f\right )-B (c d e-b d f)\right )\right ) \int \frac{1}{d+e x+f x^2} \, dx}{2 f \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}\\ &=\frac{(B c d-A c e+A b f-a B f) \log \left (a+b x+c x^2\right )}{2 \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}-\frac{(B c d-A c e+A b f-a B f) \log \left (d+e x+f x^2\right )}{2 \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}-\frac{\left (A b^2 f+2 c (A c d+a B e-a A f)-b (B c d+A c e+a B f)\right ) \operatorname{Subst}\left (\int \frac{1}{b^2-4 a c-x^2} \, dx,x,b+2 c x\right )}{c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )}-\frac{\left (e f (B c d-A c e+A b f-a B f)+2 f \left (-A f (b e-a f)+A c \left (e^2-d f\right )-B (c d e-b d f)\right )\right ) \operatorname{Subst}\left (\int \frac{1}{e^2-4 d f-x^2} \, dx,x,e+2 f x\right )}{f \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}\\ &=-\frac{\left (A b^2 f+2 c (A c d+a B e-a A f)-b (B c d+A c e+a B f)\right ) \tanh ^{-1}\left (\frac{b+2 c x}{\sqrt{b^2-4 a c}}\right )}{\sqrt{b^2-4 a c} \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}+\frac{\left (B (c d e-2 b d f+a e f)-A \left (c e^2-2 c d f-b e f+2 a f^2\right )\right ) \tanh ^{-1}\left (\frac{e+2 f x}{\sqrt{e^2-4 d f}}\right )}{\sqrt{e^2-4 d f} \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}+\frac{(B c d-A c e+A b f-a B f) \log \left (a+b x+c x^2\right )}{2 \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}-\frac{(B c d-A c e+A b f-a B f) \log \left (d+e x+f x^2\right )}{2 \left (c^2 d^2-b c d e+f \left (b^2 d-a b e+a^2 f\right )+a c \left (e^2-2 d f\right )\right )}\\ \end{align*}

Mathematica [A]  time = 0.540324, size = 267, normalized size = 0.66 \[ \frac{\frac{2 \tan ^{-1}\left (\frac{b+2 c x}{\sqrt{4 a c-b^2}}\right ) \left (-b (a B f+A c e+B c d)+2 c (-a A f+a B e+A c d)+A b^2 f\right )}{\sqrt{4 a c-b^2}}-\frac{2 \tan ^{-1}\left (\frac{e+2 f x}{\sqrt{4 d f-e^2}}\right ) \left (A \left (-2 a f^2+b e f+2 c d f-c e^2\right )+B (a e f-2 b d f+c d e)\right )}{\sqrt{4 d f-e^2}}+\log (a+x (b+c x)) (-a B f+A b f-A c e+B c d)+\log (d+x (e+f x)) (a B f-A b f+A c e-B c d)}{2 \left (f \left (a^2 f-a b e+b^2 d\right )+a c \left (e^2-2 d f\right )-b c d e+c^2 d^2\right )} \]

Antiderivative was successfully verified.

[In]

Integrate[(A + B*x)/((a + b*x + c*x^2)*(d + e*x + f*x^2)),x]

[Out]

((2*(A*b^2*f + 2*c*(A*c*d + a*B*e - a*A*f) - b*(B*c*d + A*c*e + a*B*f))*ArcTan[(b + 2*c*x)/Sqrt[-b^2 + 4*a*c]]
)/Sqrt[-b^2 + 4*a*c] - (2*(B*(c*d*e - 2*b*d*f + a*e*f) + A*(-(c*e^2) + 2*c*d*f + b*e*f - 2*a*f^2))*ArcTan[(e +
 2*f*x)/Sqrt[-e^2 + 4*d*f]])/Sqrt[-e^2 + 4*d*f] + (B*c*d - A*c*e + A*b*f - a*B*f)*Log[a + x*(b + c*x)] + (-(B*
c*d) + A*c*e - A*b*f + a*B*f)*Log[d + x*(e + f*x)])/(2*(c^2*d^2 - b*c*d*e + f*(b^2*d - a*b*e + a^2*f) + a*c*(e
^2 - 2*d*f)))

________________________________________________________________________________________

Maple [B]  time = 0.314, size = 1698, normalized size = 4.2 \begin{align*} \text{result too large to display} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int((B*x+A)/(c*x^2+b*x+a)/(f*x^2+e*x+d),x)

[Out]

1/2/(a^2*f^2-a*b*e*f-2*a*c*d*f+a*c*e^2+b^2*d*f-b*c*d*e+c^2*d^2)*ln(c*x^2+b*x+a)*A*b*f-1/2/(a^2*f^2-a*b*e*f-2*a
*c*d*f+a*c*e^2+b^2*d*f-b*c*d*e+c^2*d^2)*c*ln(c*x^2+b*x+a)*A*e-1/2/(a^2*f^2-a*b*e*f-2*a*c*d*f+a*c*e^2+b^2*d*f-b
*c*d*e+c^2*d^2)*ln(c*x^2+b*x+a)*B*a*f+1/2/(a^2*f^2-a*b*e*f-2*a*c*d*f+a*c*e^2+b^2*d*f-b*c*d*e+c^2*d^2)*c*ln(c*x
^2+b*x+a)*B*d-2/(a^2*f^2-a*b*e*f-2*a*c*d*f+a*c*e^2+b^2*d*f-b*c*d*e+c^2*d^2)/(4*a*c-b^2)^(1/2)*arctan((2*c*x+b)
/(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*e*f-2*a*c*d*f+a*c*e^2+b^2*d*f-b*c*d*e+c^2*d^2)*ln(f*x
^2+e*x+d)*B*c*d+2/(a^2*f^2-a*b*e*f-2*a*c*d*f+a*c*e^2+b^2*d*f-b*c*d*e+c^2*d^2)/(4*d*f-e^2)^(1/2)*arctan((2*f*x+
e)/(4*d*f-e^2)^(1/2))*A*a*f^2-1/(a^2*f^2-a*b*e*f-2*a*c*d*f+a*c*e^2+b^2*d*f-b*c*d*e+c^2*d^2)/(4*d*f-e^2)^(1/2)*
arctan((2*f*x+e)/(4*d*f-e^2)^(1/2))*A*b*e*f-2/(a^2*f^2-a*b*e*f-2*a*c*d*f+a*c*e^2+b^2*d*f-b*c*d*e+c^2*d^2)/(4*d
*f-e^2)^(1/2)*arctan((2*f*x+e)/(4*d*f-e^2)^(1/2))*A*c*d*f+1/(a^2*f^2-a*b*e*f-2*a*c*d*f+a*c*e^2+b^2*d*f-b*c*d*e
+c^2*d^2)/(4*d*f-e^2)^(1/2)*arctan((2*f*x+e)/(4*d*f-e^2)^(1/2))*A*c*e^2-1/(a^2*f^2-a*b*e*f-2*a*c*d*f+a*c*e^2+b
^2*d*f-b*c*d*e+c^2*d^2)/(4*d*f-e^2)^(1/2)*arctan((2*f*x+e)/(4*d*f-e^2)^(1/2))*B*a*e*f+2/(a^2*f^2-a*b*e*f-2*a*c
*d*f+a*c*e^2+b^2*d*f-b*c*d*e+c^2*d^2)/(4*d*f-e^2)^(1/2)*arctan((2*f*x+e)/(4*d*f-e^2)^(1/2))*B*b*d*f-1/(a^2*f^2
-a*b*e*f-2*a*c*d*f+a*c*e^2+b^2*d*f-b*c*d*e+c^2*d^2)/(4*d*f-e^2)^(1/2)*arctan((2*f*x+e)/(4*d*f-e^2)^(1/2))*B*c*
d*e

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: ValueError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)/(c*x^2+b*x+a)/(f*x^2+e*x+d),x, algorithm="maxima")

[Out]

Exception raised: ValueError

________________________________________________________________________________________

Fricas [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)/(c*x^2+b*x+a)/(f*x^2+e*x+d),x, algorithm="fricas")

[Out]

Timed out

________________________________________________________________________________________

Sympy [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)/(c*x**2+b*x+a)/(f*x**2+e*x+d),x)

[Out]

Timed out

________________________________________________________________________________________

Giac [F(-1)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Timed out} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate((B*x+A)/(c*x^2+b*x+a)/(f*x^2+e*x+d),x, algorithm="giac")

[Out]

Timed out